# Contributor: Orhun Parmaksız <orhunparmaksiz@gmail.com>
# Maintainer: Orhun Parmaksız <orhunparmaksiz@gmail.com>
pkgname=tere
pkgver=1.6.0
pkgrel=0
pkgdesc="Terminal file explorer"
url="https://github.com/mgunyho/tere"
# loongarch64: blocked by libc crate
arch="all !s390x !loongarch64" # FTBFS
license="EUPL-1.2"
makedepends="
	cargo
	cargo-auditable
	"
subpackages="
	$pkgname-doc
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/mgunyho/tere/archive/v$pkgver.tar.gz"
options="net"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	# https://github.com/mgunyho/tere/issues/90
	# https://github.com/mgunyho/tere/issues/93
	cargo test --frozen -- \
		--skip "skip_first_run_prompt" \
		--skip "first_run_prompt_accept" \
		--skip "first_run_prompt_cancel" \
		--skip "output_on_exit_without_cd" \
		--skip "basic_run"
}

package() {
	install -Dm 755 target/release/tere -t "$pkgdir"/usr/bin
	install -Dm 644 README.md -t "$pkgdir"/usr/share/doc/$pkgname
	install -Dm 644 ./demo/* -t "$pkgdir"/usr/share/dox/$pkgname/demo
	install -Dm 644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
28673bb7b75ec0db51c6ebc59522690f6a81c2105d7d0bf0e574f772fc51f888f568f4ced23e0ec461fcc8d50433800448efe71ea40bd7c9cf8f15bbd14fa756  tere-1.6.0.tar.gz
"
